<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" @click='fz' value="浪起来">
        <input type="button" @click='tz' value="停止">

        <h3>{{ msg }}</h3>
    </div>

    <script>
        var vm = new Vue({
            data: {
                msg: '我拿Buff,谢谢~',
                timer:''
            },
            methods: {
                fz() {
                    // console.log(this);
                    if (this.timer) clearInterval(this.timer)
                    this.timer = setInterval(() => {
                        console.log(this);
                        const a = this.msg.split('').slice(0,1).join('')
                        const b = this.msg.split('').slice(1).join('')
                        // console.log(a);
                        // console.log(b);
                        this.msg = b+a

                    },500)
                },
                tz() {
                    clearInterval(this.timer)
                }
            }
        }).$mount('#app')
    </script>
</body>

</html>